//
//  MZY_renovatePicture.m
//  FullHouse
//
//  Created by dllo on 16/1/18.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_renovatePicture.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
#define HORIZONTAL [UIScreen mainScreen].bounds.size.width / 414
#define VERTICAL [UIScreen mainScreen].bounds.size.height / 736

@implementation MZY_renovatePicture

- (void)dealloc
{
    [self.backView release];
    [self.authorImageView release];
    [self.titleLabel release];
    [self.graduationCountLabel release];
    [self.graduationLabel release];
    [self.diaryLabel release];
    [self.diaryCountLabel release];
    [self.inventoryLabel release];
    [self.inventoryCountLabel release];
    [self.likeLabel release];
    [self.likeButton release];
    [self.leftImageView release];
    [self.midImageView release];
    [self.rightImageView release];
    [self.introduceLabel release];
    [self.ornamentLabel release];
    [self.messageImageView release];
    [self.messageCountLabel release];
    [self.viewImageView release];
    [self.viewCountLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    
    self.backgroundView = [[UIView alloc]init];
    self.backgroundView.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.backgroundView];
    [self.backgroundView release];
    
    self.backView = [[UIView alloc]init];
    self.backView.backgroundColor = [UIColor whiteColor];
    [self.backgroundView addSubview:self.backView];
    [self.backView release];
    
    self.authorImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.authorImageView];
    [self.authorImageView release];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.graduationLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.graduationLabel];
    [self.graduationLabel release];
    
    self.graduationCountLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.graduationCountLabel];
    [self.graduationCountLabel release];
    
    self.diaryLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.diaryLabel];
    [self.diaryLabel release];
    
    self.diaryCountLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.diaryCountLabel];
    [self.diaryCountLabel release];
    
    self.inventoryLabel = [[UILabel alloc]init];;
    [self.backView addSubview:self.inventoryLabel];
    [self.inventoryLabel release];
    
    self.inventoryCountLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.inventoryCountLabel];
    [self.inventoryCountLabel release];
    
    self.likeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.backView addSubview:self.likeButton];
    
    self.likeLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.likeLabel];
    [self.likeLabel release];
    
    self.leftImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.leftImageView];
    [self.leftImageView release];
    
    self.midImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.midImageView];
    [self.midImageView release];
    
    self.rightImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.rightImageView];
    [self.rightImageView release];
    
    self.introduceLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.introduceLabel];
    [self.introduceLabel release];
    
    self.ornamentLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.ornamentLabel];
    [self.ornamentLabel release];
    
    self.messageImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.messageImageView];
    [self.messageImageView release];
    
    self.messageCountLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.messageCountLabel];
    [self.messageCountLabel release];
    
    self.viewImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.viewImageView];
    [self.viewImageView release];
    
    self.viewCountLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.viewCountLabel];
    [self.viewCountLabel release];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.backView.frame = CGRectMake(0, 0 , WIDTH, HEIGHT - 10 * VERTICAL);
    self.authorImageView.frame = CGRectMake(10 * HORIZONTAL, 10 * HORIZONTAL, 50 * HORIZONTAL, 50 * HORIZONTAL);
    self.titleLabel.frame = CGRectMake(70 * HORIZONTAL, 15 * VERTICAL, 250 * HORIZONTAL, 20 * VERTICAL);
    self.graduationLabel.frame = CGRectMake(70 * HORIZONTAL, 40 * HORIZONTAL, 100 * HORIZONTAL, 20 * HORIZONTAL);
    self.graduationCountLabel.frame = CGRectMake(125 * HORIZONTAL, 40 * HORIZONTAL ,30 * HORIZONTAL, 20 * VERTICAL);
    self.diaryLabel.frame = CGRectMake(145 * HORIZONTAL, 40 * HORIZONTAL, 70 * HORIZONTAL, 20 * VERTICAL);
    self.diaryCountLabel.frame = CGRectMake(180 * HORIZONTAL, 40 * HORIZONTAL, 60 * HORIZONTAL, 20 * VERTICAL);
    self.inventoryLabel.frame = CGRectMake(200 * HORIZONTAL, 40 * HORIZONTAL, 70 * HORIZONTAL, 20 * VERTICAL);
    self.inventoryCountLabel.frame = CGRectMake(240 * HORIZONTAL, 40 * HORIZONTAL, 60 * HORIZONTAL, 20 * VERTICAL);
    self.likeButton.frame = CGRectMake(WIDTH - 45 * HORIZONTAL, 10 * VERTICAL, 25 * HORIZONTAL, 25 * HORIZONTAL);
    self.likeLabel.frame = CGRectMake(WIDTH - 45 * HORIZONTAL, 40 * VERTICAL, 60 * HORIZONTAL, 20 * HORIZONTAL);
    self.leftImageView.frame = CGRectMake(10 * HORIZONTAL, 70 * HORIZONTAL, (WIDTH -30) / 3, (WIDTH -30) / 3);
    self.midImageView.frame = CGRectMake((WIDTH -30) / 3 + 15, 70 * HORIZONTAL, (WIDTH -30) / 3, (WIDTH -30) / 3);
    self.rightImageView.frame = CGRectMake((WIDTH -30) / 3 * 2 + 30 * HORIZONTAL, 70 * HORIZONTAL, (WIDTH -30) / 3, (WIDTH -30) / 3);
    self.introduceLabel.frame = CGRectMake(10 * HORIZONTAL, (WIDTH -30) / 3 + 80 * HORIZONTAL, WIDTH - 20 * HORIZONTAL, 80 * VERTICAL);
    self.ornamentLabel.frame = CGRectMake(10 * HORIZONTAL, HEIGHT - 40 * VERTICAL, 90 * HORIZONTAL, 25 * VERTICAL);
    self.messageImageView.frame = CGRectMake(WIDTH - 180 * HORIZONTAL, HEIGHT - 45 * VERTICAL, 25 * HORIZONTAL, 25 * HORIZONTAL);
    self.messageCountLabel.frame = CGRectMake(WIDTH - 145 * HORIZONTAL, HEIGHT - 40 * VERTICAL, 40 * HORIZONTAL, 20 * VERTICAL);
    self.viewImageView.frame = CGRectMake(WIDTH - 105 * HORIZONTAL, HEIGHT - 45 * VERTICAL, 25 * HORIZONTAL, 25 * HORIZONTAL);
    self.viewCountLabel.frame = CGRectMake(WIDTH - 70 * HORIZONTAL, HEIGHT - 40 * VERTICAL, 60 * HORIZONTAL, 20 * VERTICAL);
}

@end
